<template>
  <div>
    <!-- 选择职称 -->
    <el-select
      v-model="value"
      @change="handleChange"
      placeholder="请选择"
      style="width: 100%"
      clearable
      filterable
    >
      <el-option
        v-for="item in options"
        :key="item.id"
        :label="item.name"
        :value="item.name"
      >
      </el-option>
    </el-select>
  </div>
</template>
<script>
export default {
  data() {
    return {
      value: [],
      options: [
        { id: 1, name: '助教' },
        { id: 2, name: '讲师' },
        { id: 3, name: '副教授' },
        { id: 4, name: '教授' },
      ],
    }
  },
  props: {
    defaultValue: String,
  },
  watch: {
    defaultValue(v) {
      this.value = v
    },
  },
  mounted() {
    this.value = this.defaultValue
  },
  methods: {
    handleChange(value) {
      this.$emit('emit', value)
    },
  },
}
</script>